package org.example.auth.controller;

import org.example.auth.service.LoginService;
import org.example.auth.vo.LoginVo;
import org.example.core.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * @author 小杰_cc
 * @version 1.0
 */

@RestController
@RequestMapping("/auth")
public class LoginController {

    @Autowired
    private LoginService loginService;

    /**
     * 发送验证码
     */
    @PostMapping("/code")
    public R<String> sendCode(@RequestBody String phone){
        return loginService.sendCode(phone);
    }

    /**
     * 短信验证码登录
     */
    @PostMapping("/login")
    public R<HashMap<String, String>> login(@RequestBody LoginVo loginVo){
        return loginService.login(loginVo);
    }
}